#ifndef GAME_HPP
#define GAME_HPP

#include <boost/date_time.hpp>
#include <boost/signals2.hpp>
#include <boost/thread.hpp>
#include <queue>

#include "rts_room.hpp"

class game;

typedef boost::shared_ptr<game> game_ptr;
typedef std::map<int, std::wstring> order_map;

class game :
   public rts_room
{
public:
    game(std::vector<boost::shared_ptr<rts_client> >& players);
    ~game()
    {
        std::cout << "Game Over" << std::endl;
    }

    void receive_message(const std::wstring &message, boost::shared_ptr<client> sender);
    boost::signals2::signal<void (game_ptr)>& game_over() { return _game_over; }

    enum game_messages
    {
        initial_game_state = 0,
        orders = 1,
        chat = 2
    };

private:
    bool _active;
    std::vector<boost::shared_ptr<rts_client> > _players;
    boost::signals2::signal<void (game_ptr)> _game_over;
    int _current_frame;
    std::map<int, order_map> _orders;
    static int _start_credits;

    void initialize_game_state();
    void player_dc(boost::shared_ptr<client> c);
};



#endif // GAME_HPP
